﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;

namespace ZGameFramework.UI
{
    public class BubbleCellColor : BubbelCellBase
    {
        public Color from = Color.white;
        public Color to = Color.white;

        private MaskableGraphic maskableGraphic;


        private void OnEnable()
        {
            if (null == maskableGraphic) { maskableGraphic = gameObject.GetComponent<MaskableGraphic>(); }

            if (null != maskableGraphic) { maskableGraphic.color = from; }
        }

        public override void StartFadeIn()
        {
            maskableGraphic.color = from;
            maskableGraphic.DOColor( to, duration );
        }

        public override void StartFadeOut()
        {
            maskableGraphic.color = to;
            maskableGraphic.DOColor(from, duration);
        }

    }
}